package pers.qianyu.domain.dto;

import lombok.*;
import org.hibernate.validator.constraints.*;
import pers.qianyu.util.*;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.*;
import java.io.*;
import java.time.*;

/**
 * 用户 DTO 实体
 *
 * @author mizzle rain
 * @date 2020-10-11 22:12
 */
@Data
public class UserDTO implements Serializable {
    private static final long serialVersionUID = -3521839311828509323L;
    /**
     * 用户名
     */
    @NotEmpty(message = "用户名不能为空！", groups = {InsertValidationGroup.class})
    private String username;
    /**
     * 密码
     */
    @NotEmpty(message = "密码不能为空！", groups = {InsertValidationGroup.class})
    @Length(min = 6, max = 18, message = "密码长度不能少于6位，不能多于18位")
    private String password;
    /**
     * 邮箱
     */
    @NotEmpty(message = "邮箱不能为空！", groups = {InsertValidationGroup.class})
    @Email(message = "邮箱格式不能为空")
    private String email;
    /**
     * 电话
     */
    @NotEmpty(message = "手机号不能为空！", groups = {InsertValidationGroup.class})
    private String phone;

    /**
     * 年龄
     */
    @NotNull(message = "年龄不能为空！", groups = {InsertValidationGroup.class})
    @Max(value = 60, message = "年龄最大不能超过60岁")
    @Min(value = 18, message = "年龄最小不能小于18岁")
    private Integer age;
    /**
     * 创建时间
     */
    private LocalDateTime createTime;
    /**
     * 版本号
     */
    @NotNull(message = "版本号不能为空！", groups = {UpdateValidationGroup.class})
    private Long version;
}
